home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Personal Computer World 2009 February
/
PCWFEB09.iso
/
Software
/
Resources
/
Chat & Communication
/
Digsby build 37
/
digsby_setup.exe
/
lib
/
PIL
/
DcxImagePlugin.pyo
(
.txt
)
< prev
next >
Wrap
Python Compiled Bytecode
|
2008-10-13
|
2KB
|
55 lines
# Source Generated with Decompyle++
# File: in.pyo (Python 2.5)
__version__ = '0.2'
import Image
import ImageFile
from PcxImagePlugin import PcxImageFile
MAGIC = 987654321
def i32(c):
return ord(c[0]) + (ord(c[1]) << 8) + (ord(c[2]) << 16) + (ord(c[3]) << 24)
def _accept(prefix):
return i32(prefix) == MAGIC
class DcxImageFile(PcxImageFile):
format = 'DCX'
format_description = 'Intel DCX'
def _open(self):
s = self.fp.read(4)
if i32(s) != MAGIC:
raise SyntaxError, 'not a DCX file'
self._offset = []
for i in range(1024):
offset = i32(self.fp.read(4))
if not offset:
break
self._offset.append(offset)
self._DcxImageFile__fp = self.fp
self.seek(0)
def seek(self, frame):
if frame >= len(self._offset):
raise EOFError('attempt to seek outside DCX directory')
self.frame = frame
self.fp = self._DcxImageFile__fp
self.fp.seek(self._offset[frame])
PcxImageFile._open(self)
def tell(self):
return self.frame
Image.register_open('DCX', DcxImageFile, _accept)
Image.register_extension('DCX', '.dcx')